package com.itheima.tanhua.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.common.ResultInfo;
import com.itheima.domain.db.User;
import com.itheima.domain.db.UserInfo;
import com.itheima.tanhua.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zsk
 * @create 2022-03-30-15:42
 */
@RestController
public class UserInfoController {


    @Autowired
    private UserInfoService userInfoService;

    //分页查询用户信息
    @GetMapping("/dish/page")
    public ResponseEntity findByPage(
            @RequestParam(value = "page",defaultValue = "1")Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize,
            String name){

        //调用service
        Page<UserInfo> page = userInfoService.findByPage(name,pageNum,pageSize);

        //返回结果
        return ResponseEntity.ok(page);
    }

    //分页查询题库
    @GetMapping("/setmeal/page")
    public ResponseEntity findByTiByPage(
            @RequestParam(value = "page",defaultValue = "1")Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize
    ){
        //返回结果
        return ResponseEntity.ok(null);
    }



}
